Skip to content

feat(posixfs): #3182 add basepath option in the "posixfs scan" command - #3191

Merged
aduffeck merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:feat/#3182-posixfs-scan-subtree
Jul 31, 2026
Merged

feat(posixfs): #3182 add basepath option in the "posixfs scan" command#3191
aduffeck merged 1 commit into
opencloud-eu:mainfrom
pbleser-oc:feat/#3182-posixfs-scan-subtree

Conversation

@pbleser-oc

Copy link
Copy Markdown
Member

Description

Adds support for specifying a basepath using -p when running the posixfs scan command, to indicate a directory under which to start scanning, or a singular file to scan, as opposed to scanning from the storage root directory as is the default behaviour

Related Issue

Motivation and Context

In some scenarios, a system administrator might want to run the posixfs scan command under a specific subdirectory of the storage root instead of the whole tree under the storage root. This is made possible by specifying the basepath introduced with this change.

How Has This Been Tested?

Tested manually in a local environment, by disabling posixfs watching (with STORAGE_USERS_POSIX_WATCH_FS set to false) and then copying files into the storage, checking that they had no xattrs set on them (using getfattr -d), running the posixfs scan command on them, both on individual files and on the containing directory, and then checking that OpenCloud posixfs metadata has been set on those files afterwards (again using getfattr -d).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation added

@codacy-production

codacy-production Bot commented Jul 29, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 10 complexity · 0 duplication

Metric Results
Complexity 10
Duplication 0

View in Codacy

🟢 Coverage 20.00% diff coverage · +0.00% coverage variation

Metric Results
Coverage variation +0.00% coverage variation (-1.00%)
Diff coverage 20.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (bb8cefa) 83760 19256 22.99%
Head commit (433dea4) 83813 (+53) 19269 (+13) 22.99% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3191) 55 11 20.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@pbleser-oc
pbleser-oc force-pushed the feat/#3182-posixfs-scan-subtree branch 2 times, most recently from 661e4a7 to b1a9d81 Compare July 30, 2026 09:39

@aduffeck aduffeck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm besides the nitpicks.

Comment thread pkg/x/path/filepathx/path.go Outdated
if err != nil {
return false, fmt.Errorf("failed to make parent directory absolute: %q: %w", parent, err)
}
absParent = filepath.Clean(absParent)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filepath.Abs actually calls Clean on the result before returning it, so this line is redundant and can be removed.

Comment thread pkg/x/path/filepathx/path.go Outdated
if err != nil {
return false, fmt.Errorf("failed to make child file/directory absolute: %q: %w", child, err)
}
absChild = filepath.Clean(absChild)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

Comment thread pkg/x/path/filepathx/path.go Outdated
Comment on lines +38 to +40
} else {
return true, nil
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe simplify this to

Suggested change
} else {
return true, nil
}
}
return true, nil

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, made the changes, they were trivial and not worth keeping in the history, so I recommitted and force-pushed.

…scan" command

 * add support for specifying a basepath using -p when running the
   posixfs scan command, to indicate a directory under which to start
   scanning, or a singular file to scan, as opposed to scanning from the
   storage root directory as is the default behaviour

 * implements opencloud-eu#3182
@pbleser-oc
pbleser-oc force-pushed the feat/#3182-posixfs-scan-subtree branch from b1a9d81 to 433dea4 Compare July 31, 2026 13:07

@aduffeck aduffeck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, lgtm

@aduffeck
aduffeck merged commit 942cca8 into opencloud-eu:main Jul 31, 2026
62 of 63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants